<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>鼠标修饰符</title>
</head>
<body>
<div id="app">
    <!--默认为左键单击，可以不使用修饰符-->
    <button @click="leftClicked">左键单击</button>
    <button @click.middle="middleClicked">滚轮单击</button>
    <button @click.right="rightClicked">右键单击</button>
    <hr>
    <button @click.left="leftClicked">左键单击</button>
</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                function leftClicked(event) {
                    console.log("左键单击");
                }

                function middleClicked(event) {
                    console.log("滚轮单击");
                }

                function rightClicked(event) {
                    console.log("右键单击");
                }

                return {
                    leftClicked,
                    middleClicked,
                    rightClicked,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>